import request from "@/utils/request.js"

// 1 获取登陆人的身份信息，permission，党员common、支部管理员admin 不是党支部的null
export function apiIdentityInfo() {
	return request({
		url: `/app/dj/user/getLoginUser`
	})
}

// 2 获取活动类型
export function getAllEnumMap() {
	return request({
		url: `/enumerate/getAllEnumMap`
	})
}

// 3 获取参与人员
export function getJoinUser(djDeptId) {
	return request({
		url: `/masses/getTbUserInfoList?djDeptId=${djDeptId}`
	})
}

// 4 保存草稿箱
export function saveDrafts(data) {
	return request({
		url: `/masses/saveDrafts`,
		method: 'post',
		data
	})
}

// 5 发起活动
export function sendActivity(data) {
	return request({
		url: `/masses/activity`,
		method: 'post',
		data
	})
}

// 6 草稿箱列表
export function getDraftsList(params) {
	params.djDeptId = JSON.parse(uni.getStorageSync('loginUserInfo')).djDeptId;
	
	return request({
		url: `/masses/draftsList`,
		data: params
	})
}

// 7 发起活动-活动地点
export function apiChamberList() {
	return request({
		url: `/masses/chamberList`
	})
}

// 8 发起活动-活动列表
export function apiActivityList(data) {
	// const userId = JSON.parse(uni.getStorageSync('loginUserInfo')).uid;
	const djDeptId = JSON.parse(uni.getStorageSync('loginUserInfo')).djDeptId;

	return request({
		url: `/masses/getActivityList?djDeptId=${djDeptId}`,
		data
	})
}

// 9 草稿箱单个、批量删除
export function apiDeleteDrafts(dqActivityId) {
	return request({
		url: `/masses/deleteDrafts/${dqActivityId}`,
		method: 'delete'
	})
}

// 10 扫描二维码签到
export function apiQrCodeSign(params) {
	return request({
		url: `/masses/qrCodeSign?dqActivityId=${params.dqActivityId}&id=${params.id}`
	})
}

// 11 获取参与活动人员列表
export function apiQrCodeSignList(params) {
	return request({
		url: `/masses/qrCodeSignList?dqActivityId=${params}`
	})
}

// 12 撤销活动
export function apiRevocAtion(dqActivityId) {
	return request({
		url: `/masses/revocation?dqActivityId=${dqActivityId}`
	})
}


// 13 活动台账 - 上传
export function apiuploadAccount(data) {
	const djDeptId = JSON.parse(uni.getStorageSync('loginUserInfo')).djDeptId;
	data.djDeptId = djDeptId;

	return request({
		url: `/publicity/saveActivityLedger`,
		method: 'post',
		data
	})
}

// 14 活动台账 - 列表
export function apiActivityLedgerList(params) {
	return request({
		url: `/publicity/getActivityLedgerList`,
		data: params
	})
}

// 15 活动台账 - 删除
export function apiDeleteLedgerItem(djBookId) {
	return request({
		url: `/publicity/deleteActivityLedger/${djBookId}`,
		method: "delete"
	})
}

// 16 宣传通讯 - 上传
export function apiUploadCommunication(data) {
	return request({
		url: `/publicity/saveUpload`,
		method: 'post',
		data
	})
}

// 17 宣传通讯 - 列表
export function apiUploadList(params) {
	return request({
		url: `/publicity/getUploadList`,
		data: params
	})
}

// 17 宣传通讯 - 批量删除
export function apiDeleteUpload(ledgerId) {
	return request({
		url: `/publicity/deleteUpload/${ledgerId}`,
		method: "delete"
	})
}

// 18 上传活动台账
export function apiUploadTaiZhang(data) {
	return request({
		url: `/publicity/saveActivityLedger`,
		method: 'post',
		data
	})
}

// 19 党群活动通知 / status 0未读 2已读 /  uid
export function apiHuoDongTongZhi(data) {
	return request({
		url: `/masses/activityNoticeList`,
		data
	})
}